package hsl.study.v2;


import java.util.UUID;

/**
 * @author HSL
 * @version 1.0
 * @data 2025/11/17 10:41
 * @desc cglib测试类
 */

public class CglibTest {
    public static void main(String[] args) {
        // 创建目标对象
        OrderService orderService = new OrderService();

        // 创建代理对象
        CglibProxyFactory factory = new CglibProxyFactory(orderService);
        OrderService proxyInstance = (OrderService) factory.getProxyInstance();

        // 调用方法
        String orderNumber = UUID.randomUUID().toString();
        proxyInstance.addOrder(orderNumber);

        System.out.println("------------------------");
        String order = proxyInstance.getOrder(orderNumber);
        System.out.println("查询到的订单为：" + order);
    }
}
